<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link href="<%=path%>/CSS/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<style type="text/css">
.seachform li label{line-height: 45px;color: #444444	}
.scinput{line-height: 10px;margin-top: 5px}
.scinput1{margin-top: 5px;height: 30px;}
.scbtn{background: #57a0ff;border-radius:20px;width: 110px;margin-top: 4px;height: 35px}
.scbtn2{height: 20px;background: #57a0ff;border-radius:20px;width: 50px;color: #fff;display: none;}
{}
.tablelist th{background: none;border-bottom: none;}
thead {background: #f2f2f2}
tbody tr:nth-child(even) {background: #f7f8fd}
.tablelist th{height: 45px;padding-left: 30px}
.tablelist td{border-right:none;padding-left: 30px}
tbody tr{height: 38px}
.check{padding-left: 0px}
a{cursor: pointer;}
.tablelist{width:500px;border:0px;border-collapse:collapse;border-spacing:0;}
.tablelist tr{height:30px;}
.tablelist tr td{border-bottom:1px solid #BBB;}
</style>
</head>
<body style="background: #f5f5f5;padding: 0 10px;">
<div id="location_top">
		<div class="place" style="background: #f5f5f5;margin-top: 10px">
			<ul class="placeul">
				<li><a href="#">基础资料</a></li>
				<li><a href="#">职员基础资料</a></li>
				<li><a href="<%=path%>/DrivingSys/queryPerson/look.action">职员</a></li>
			</ul>
		</div>
	
		<div class="rightinfo" style="background: #fff;border-radius:10px;height: 45px;">

			<form action="<%=path%>/DrivingSys/queryPersonByInfo" method="post">
				<ul class="seachform">
					    <li><label>姓名</label><input name="fnameL2" type="text" class="scinput" value="${fnameL2}"/></li>
					    <li><label>电话</label><input name="cfcell" type="text" class="scinput" value="${cfcell}"/></li>
					    <li><label>身份证号</label><input name="cfidcardno" type="text" class="scinput" value="${cfidcardno}"/></li>
					    <li><label>社保编号</label><input name="cfaccountsno" type="text" class="scinput" value="${cfaccountsno}"/></li>
						<li><label>&nbsp;</label><input name="" type="submit"  class="scbtn" value="立即查询" /></li>
				</ul>
			</form>
		</div>
</div>
<div id="data_table_new"
	 style="margin-bottom: 0px;margin-top: 30px;background: #fff;border-radius:10px;box-shadow: 0 0 10px #f2f2f2;">
			<ul>
				 <li style="height: 40px;text-align: left;color: #999999;">
				  <span style="font-size: 12px;">
				  <shiro:hasPermission name="/insertPerson">
					  <img alt="" style="margin-top: 20px;margin-left: 22px;height: 12px;" src="<%=path%>/images/list/xz.png">
					       &nbsp;<a href="<%=path%>/DrivingSys/insertPerson">新增</a>
			       </shiro:hasPermission>
			       <shiro:hasPermission name="/deletePersonByFid">
					  <img alt="" style="margin-top: 20px;margin-left: 22px;height: 12px;" src="<%=path%>/images/list/sc.png">
					       &nbsp;<a class="del">删除</a>
				   </shiro:hasPermission>
				   <shiro:hasPermission name="/selectPersonByFid">
					  <img alt="" height="11px" src="<%=path%>/images/list/xg.png" style="padding-left: 20px"> 
					  <a  class="modify">修改</a>
				   </shiro:hasPermission>
					  <shiro:hasPermission name="/importPerson">
					  <img alt="" style="margin-top: 20px;margin-left: 22px;height: 12px;width: 14px"
                           src="<%=path%>/images/list/excel.png">
                          <a id="importExcel">导出Excel</a>
                      </shiro:hasPermission>
				  </span>
				 </li>
			</ul>
		<table class="tablelist" style="white-space:nowrap;">
			<thead>
				<tr>
					<th><input type="checkbox" class="check2"></th>
					<th>员工编号</th>
					<th>员工姓名</th>
					<th>部门</th>
					<th>员工类型</th>
					<th>身份证号码</th>
					<th>手机号码</th>
					<th>地址</th>
					<th>出生日期</th>
					<th>入职日期</th>
					<th>转正日期</th>
					<th>离职日期</th>
					<th>合同到期日</th>
					<th>社保编号</th>
					<th>车辆</th>
					<th>性别</th>
					<th>职级职等</th>
					<th>薪酬调整</th>
					<th>岗位异动</th>
					<th>请假记录</th>
					<th>违纪奖励记录</th>
					<th>社会保险记录</th>
					<th>计算招生提成</th>
					<th>计算培训提成</th>
					<th>操作</th>
				</tr>
			</thead>
			<c:forEach items="${persons}" var="persons" varStatus="s">
				<tr class="xq">
					<td><input type="checkbox" class="check"  value="${persons.fid}" name="check"/></td>
					<td>${persons.fnumber}</td>
					<td>${persons.fnameL2}</td>
					<td>${persons.cfpersondepName}</td>
					<c:if test="${empty persons.cfpersontype}">
						<td></td>
					</c:if>
					<c:if test="${persons.cfpersontype == '0'}">
						<td></td>
					</c:if>
					<c:if test="${persons.cfpersontype == '1'}">
						<td>办公室职员</td>
					</c:if>
					<c:if test="${persons.cfpersontype == '2'}">
						<td>教练</td>
					</c:if>
					<c:if test="${persons.cfpersontype == '3'}">
						<td>其他</td>
					</c:if>
					<td>${persons.cfidcardno}</td>
					<td>${persons.cfcell}</td>
					<td>${persons.cfaddress}</td>
					<td>${persons.cfbirthdays}</td>
					<td>${persons.cfbegindate}</td>
					<td>${persons.cfstartdate}</td>
					<td>${persons.cfenddate}</td>
					<td>${persons.cfhtdqsj}</td>
					<td>${persons.cfaccountsno}</td>
					<td>${persons.cfcarName}</td>
					<c:if test="${empty persons.cfsex}">
						<td></td>
					</c:if>
					<c:if test="${persons.cfsex == '1'}">
						<td>男</td>
					</c:if>
					<c:if test="${persons.cfsex == '2'}">
						<td>女</td>
					</c:if>
					<td>${persons.positiongradeName}</td>
					<td>${persons.cfxctz}</td>
					<td>${persons.cfgwyd}</td>
					<td>${persons.cfqjjl}</td>
					<td>${persons.cfwjjljl}</td>
					<td>${persons.cfshjljl}</td>
					<c:if test="${empty persons.cfzstc}">
					<td><input type="checkbox" disabled="disabled"></td>
					</c:if>
					<c:if test="${persons.cfzstc == '0'}">
					<td><input type="checkbox" disabled="disabled"></td>
					</c:if>
					<c:if test="${persons.cfzstc == '1'}">
					<td><input type="checkbox" disabled="disabled" checked="checked"></td>
					</c:if>
					<c:if test="${empty persons.cfpxtc}">
					<td><input type="checkbox" disabled="disabled"></td>
					</c:if>
					<c:if test="${persons.cfpxtc == '0'}">
					<td><input type="checkbox" disabled="disabled"></td>
					</c:if>
					<c:if test="${persons.cfpxtc == '1'}">
					<td><input type="checkbox" disabled="disabled" checked="checked"></td>
					</c:if>
					<td>
					<shiro:hasPermission name="/selectPersonByFid">
					   <img alt="" height="11px" src="<%=path%>/images/list/xg.png">
						<a href="<%=path%>/DrivingSys/selectPersonByFid?fid=${persons.fid}" class="tablelink">修改</a>
						&nbsp;&nbsp;&nbsp;
					</shiro:hasPermission>
					<shiro:hasPermission name="/deletePersonByFid">
						<img style="margin-top: 20px; margin-left: 10px; height: 12px;"src="<%=path%>/images/list/sc.png"> 
						<a class="delOne" class="tablelink" style="color: #056dae">删除
						<input type="hidden" value="${persons.fid}">
						</a>
						&nbsp;&nbsp;&nbsp;
					</shiro:hasPermission>
				    </td>
				</tr>
			</c:forEach>
		</table>
		</div>
<div id="location_bottom">
		<pg:pager items="${pb.tr}" url="look.action" export="offset,currentPageNumber=pageNumber" maxPageItems="${pb.ps}">  
            <pg:index>  
               <pg:first>
               <a href="${pageUrl}&&type=${type}" >
               <nobr>
               [首页]
               </nobr>
              </a>   
               </pg:first>  
               <pg:prev><a href="${pageUrl}&&type=${type}">前一页</a></pg:prev>  
               <pg:pages>  
                     <c:choose>  
                        <c:when test="${currentPageNumber eq pageNumber}">    
                           <font color="red">${pageNumber }</font>  
                        </c:when>    
                        <c:otherwise>    
                           <a href="${pageUrl}&&type=${type}">${pageNumber}</a>   
                        </c:otherwise>    
                     </c:choose>  
               </pg:pages>  
               <pg:next><a href="${pageUrl}&&type=${type}">下一页</a></pg:next>  
               <pg:last><a href="${pageUrl}&&type=${type}"><nobr>[尾页]</nobr></a></pg:last>  
            </pg:index>      
         </pg:pager>  
</div>
			<div style="height: 30px"></div>
        <div id="tip2"></div>
		<div class="tip">
			<div class="tiptop">
                <span>提示信息</span>
			</div>
			<div class="tipinfo">
				<span><img src="<%=path%>/images/ticon.png" /></span>
				<div class="tipright">
					<p>是否确认对信息删除 ？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>
			<div class="tipbtn">
				<input name="" type="button" class="sure" value="确定" />&nbsp; <input
					name="" type="button" class="cancel" value="取消" />
			</div>
		</div>
</body>
<script type="text/javascript" src="<%=path%>/JS/tempJs/tool.js"></script>
<script type="text/javascript">

	$(function () {
        //设置删除弹框的left值
        $(".tip").css("left",$(".tablelist").width()-1000)
    })


		$(document).ready(function(){
            fixation_List()
            var flag = "${flag}"
            if (flag == null || flag == '') {

            } else {
                editAlert();
            }
			$('.del').click(function(){
				var fidids = document.getElementsByName("check");
				var carid; 
				for( var i = 0; i < fidids.length; i++){
					if (fidids[i].checked){
						carid = fidids[i].value;
					}
				}
				if(carid == null || carid == ""){
					alert("请至少选择一条数据删除")
					return false
				}else{
                    $("#tip2").css('visibility', 'visible');
					$(".tip").fadeIn(200);
				}
				 $(".sure").click(function(){
					  $(".tip").fadeOut(100);
					  $('.check').toggle()
					  $('.scbtn2').toggle()
					  /* location='deleteCarByFid?deleteId='+deleteId+''; */
					  var str = new Array(); 
					  var fids = document.getElementsByName("check");
						  for( var i = 0; i < fids.length; i++ ){
							  if (fids[i].checked){
								  str[i] = fids[i].value;
						  	   }
						  }
						  if(str == null || str == ''){
							  alert("至少勾选一条数据删除")
							  return false
						  }else{
							  location='<%=path%>/DrivingSys/deletePersonByFid?deleteId='+str+''; 
						  }
					  })
					  $(".cancel").click(function(){
						  $(".tip").fadeOut(100);
                          $("#tip2").css('visibility', 'hidden');
					  })
			})
			
		//删除单个
	$('.delOne').click(function(){
        $(".tip").animate(({top: $(window).scrollTop()+250}));

        var fid = $(this).find("input:hidden").val();
        $("#tip2").css('visibility', 'visible');
			$(".tip").fadeIn(200);
				$(".sure").click(function(){
					location='<%=path%>/DrivingSys/deletePersonByFid?fid='+fid+''; 
				})
			
				 $(".cancel").click(function(){
					  $(".tip").fadeOut(100);
                     $("#tip2").css('visibility', 'hidden');
				});
		})
	//修改
 	$(".modify").click(function(){
 		var stringFid; 
 		var fids = document.getElementsByName("check");
 		for( var i = 0; i < fids.length; i++ ){
				if (fids[i].checked){
					stringFid = fids[i].value;
					location = '<%=path%>/DrivingSys/selectPersonByFid?fid='+stringFid+'';
					return false
				  }
		}
 		if(stringFid == null || stringFid.length == 0){
 			alert("请至少选择一条数据修改")
			return false
 		}
 	})
		
	//查询详情
	 $(".xq").dblclick(function(){
		 var modify = $(".modify").text();
		 if(modify == '' || modify == null){
				
		}else{
		 	var fid2 = $(this).find(".check").val();
		 	//避免fid中有+，或者特殊字符
		 	var fid = encodeURI(fid2).replace(/\+/g,'%2B')
             gotoSelectCard(this,'/DrivingSys/selectPersonByFid?fid='+fid);
		}
	 })
	 
	 	//设置全选功选 
		$('.check2').click(function(){
			if($(this).attr("checked")){
				 $(":checkbox").prop("checked",true) 
			}else{
				$('input:checkbox').removeAttr('checked')
			}
		})
})

        //导出
        $("#importExcel").click(function () {
            var fnameL2 = $("input[name='fnameL2']").val();//姓名
            var cfcell = $("input[name='cfcell']").val();//电话
            var cfidcardno = $("input[name='cfidcardno']").val();//身份证号
            var cfaccountsno = $("input[name='cfaccountsno']").val();//社保编号
            location = '<%=path%>/DrivingSys/importPerson?fnameL2=' + fnameL2 + '&cfcell=' + cfcell + '&cfidcardno=' + cfidcardno + '&cfaccountsno=' + cfaccountsno
        })
</script>
</html>